<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p class="content"></p>
    <script>
        setInterval(function () {
            /* 计算现在时间距离 2022年6月27号9:00 时间差 显示页面上，实时倒计时。 */
            var futureTime = new Date(2022, 5, 27, 9, 0);
            // 2022年6月27号9:00的时间戳
            var timeFutureGap = futureTime.getTime();
            // 现在的时间戳
            var nowTime = new Date();
            var nowTimeGap = nowTime.getTime();
            var gap = timeFutureGap - nowTimeGap;
            var millisecond = gap % 1000
            var second = (gap - gap % 1000) / 1000 % 60
            var minutes = ((gap - gap % 1000) / 1000 - (gap - gap % 1000) / 1000 % 60) / 60 % 60
            var hours = (gap - gap % 3600000) / 3600000 % 24;
            var days = ((gap - gap % 3600000) / 3600000 - (gap - gap % 3600000) / 3600000 % 24) / 24;
            var str = `距离2022年6月27号9:00 的倒计时为${days}天${hours}小时${minutes}分${second}秒${millisecond}毫秒`;
            document.getElementsByClassName("content")[0].innerHTML = str;
        }, 1);
    </script>
</body>

</html>